import http from '@/utils/https'
import type { CategoryTopItem } from '@/types/category'
import type { BannerItem } from '@/types/global'

/**
 * 获取轮播广告图数据
 * @param {number} [distributionSite] - 广告区域展示位置：1 为首页（默认值） 2 为商品分类页
 * @returns {Promise}
 */
export function getHomeBannerAPI(distributionSite = 2) {
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    data: {
      distributionSite,
    },
  })
}

/**
 * 获取分类数据
 * @returns {Promise}
 */
export function getCategoryTopAPI() {
  return http<CategoryTopItem[]>({
    method: 'GET',
    url: '/category/top',
  })
}
